package com.wing.order.model.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.core.enums.IEnum;
import com.wing.mybatis.common.BaseEntity;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.io.Serializable;

/**
 * 出/入库作业单记录
 *
 * @author
 */
@Data
@NoArgsConstructor
@Accessors(chain = true)
@TableName("ord_inventory_inout_job")
public class InventoryInoutJob extends BaseEntity<InventoryInoutJob> implements Serializable {

    private static final long serialVersionUID = 1L;

    public enum StorageType implements IEnum<Integer> {

        /**
        * 生产入库
        */
        production(1,"生产入库"),
        /**
        * 采购入库
        */
        purchase(2,"采购入库"),
        /**
        * 调拨入库
        */
        allot(3,"调拨入库"),
        /**
        * 盘点入库
        */
        check(4,"盘点入库"),
        /**
        * 换货入库
        */
        barter(5,"换货入库"),
        /**
        * 报损入库
        */
        breakage(6,"报损入库"),
        /**
         * 签收刀具
         */
        cutter(7,"签收刀具");
        private int code;
        private String desc;

        StorageType(int code,String desc){
            this.code=code;
            this.desc=desc;
        }

        @Override
        public Integer getValue(){
            return this.code;
        }

        public String getDesc(){
            return this.desc;
        }
    }

    public enum Status implements IEnum<Integer> {

        /**
         * 待审核
         */
        confirmed(0,"待审核"),
        /**
         * 已审核
         */
        confirm(1,"已审核"),
        /**
         * 已签收
         */
        sign(2,"已签收"),
        /**
         * 签收中
         */
        signin(3,"签收中"),
        /**
         * 入库中
         */
        storagein(4,"入库中"),
        /**
         * 已入库
         */
        storage(5,"已入库");

        private int code;
        private String desc;

        Status(int code,String desc){
            this.code=code;
            this.desc=desc;
        }

        @Override
        public Integer getValue(){
            return this.code;
        }

        public String getDesc(){
            return this.desc;
        }
    }

    public enum InoutType implements IEnum<Integer> {

        /**
        * 入库
        */
        in(1,"入库"),
        /**
        * 出库
        */
        out(2,"出库");

        private int code;
        private String desc;

        InoutType(int code,String desc){
            this.code=code;
            this.desc=desc;
        }

        @Override
        public Integer getValue(){
            return this.code;
        }

        public String getDesc(){
            return this.desc;
        }
    }

    public enum FromSign implements IEnum<Integer> {

        /**
        * 来自小程序
        */
        app(1,"来自小程序");

        private int code;
        private String desc;

        FromSign(int code,String desc){
            this.code=code;
            this.desc=desc;
        }

        @Override
        public Integer getValue(){
            return this.code;
        }

        public String getDesc(){
            return this.desc;
        }
    }

    /**
     * 创建者
     */
    private Long creator;

    /**
     * 修改者
     */
    private Long modifier;

    /**
     * 创建人
     */
    private String creatorName;

    /**
     * 修改人
     */
    private String modifierName;

    /**
     * 入库作业单编号
     */
    private String code;

    /**
     * 入库计划单编号
     */
    private String planCode;

    /**
     * 产品SKU id
     */
    private Long skuId;

    /**
     * 产品SKU编号
     */
    private String skuCode;

    /**
     * 产品编号
     */
    private String productCode;

    /**
     * 产品类型
     */
    private String productType;

    /**
     * 入库类型
     */
    private StorageType storageType;

    /**
    * 入库类型描述
    */
    @TableField(exist = false)
    private String storageTypeDesc;

    public String getStorageTypeDesc() {
        return storageType == null ? null : storageType.getDesc();
    }

    /**
     * 单位名称
     */
    private String unitName;

    /**
     * 产品单位id
     */
    private Long unitId;

    /**
     * 入库数量
     */
    private Long quantity;

    /**
     * 仓库
     */
    private Long warehouseId;

    /**
     * 仓库名称
     */
    private String warehouseName;

    /**
     * 状态
     */
    private Status status;

    /**
    * 状态描述
    */
    @TableField(exist = false)
    private String statusDesc;

    public String getStatusDesc() {
        return status == null ? null : status.getDesc();
    }

    /**
     * 入库计划编号
     */
    private String storagePlanCode;

    /**
     * 出/入库计划id
     */
    private Long planId;

    /**
     * 签收数量
     */
    private Long signQuantity;

    /**
     * 入库签收人id
     */
    private Long signPeopleId;

    /**
     * 入库签收人名称id
     */
    private String signPeopleName;

    /**
     * 入库签收工位id
     */
    private Long signStationId;

    /**
     * 入库签收工位
     */
    private String signStationName;

    /**
     * 入库单id
     */
    private Long inventoryInoutId;

    /**
     * 出入库类型
     */
    private InoutType inoutType;

    /**
    * 出入库类型描述
    */
    @TableField(exist = false)
    private String inoutTypeDesc;

    public String getInoutTypeDesc() {
        return inoutType == null ? null : inoutType.getDesc();
    }

    /**
     * 序号
     */
    private Integer no;

    /**
     * 产品类型id
     */
    private Long productTypeId;

    /**
     * day
     */
    private Integer day;

    /**
     * 来自签收单
     */
    private FromSign fromSign;

    /**
    * 来自签收单描述
    */
    @TableField(exist = false)
    private String fromSignDesc;

    public String getFromSignDesc() {
        return fromSign == null ? null : fromSign.getDesc();
    }

    /**
     * 签收单id
     */
    private Long deliveryId;

    /**
     * 出入库类型code
     */
    private String inoutTypeCode;
    /**
     * 入库类型名称
     */
    private String inoutTypeName;

}
